package br.com.wepa.webapps.orca.logica.negocio.facade.basic;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import br.com.wepa.webapps.orca.logica.persistencia.search.Searcher;
import br.com.wepa.webapps.search.Order;
import br.com.wepa.webapps.search.PagingBean;

// Generated 02/12/2006 03:16:44 by Hibernate Tools 3.2.0.beta8

/**
 * Transfer Object Generico
 */
public abstract class GenericTO<ID extends Serializable>  extends BasicTO{
	private Boolean update= false;
	private Boolean  lock = false;
	private GenericTO<ID> storeTO;
	
	private Boolean  showSearchResults = false;
	private Boolean  searcherEnabled = false;	
	private Searcher searcher = new Searcher("beanList");	
	private PagingBean pagingBean = new PagingBean();
	private List<Order> orderList = new LinkedList<Order>();
	
	
	public GenericTO<ID> getStoreTO() {
		return storeTO;
	}

	public void setStoreTO(GenericTO<ID> updateTO) {
		this.storeTO = updateTO;
	}

	public boolean getLock() {
		return lock;
	}

	public void setLock(Boolean lock) {
		this.lock = lock;
	}
	public boolean getUpdate() {
		return update;
	}

	public void setUpdate(Boolean update) {
		this.update = update;
	}
	
	public abstract ID getId();
	
	public abstract void setId(ID id);

	public Boolean getShowSearchResults() {
		return showSearchResults;
	}

	public void setShowSearchResults(Boolean showSearchResults) {
		this.showSearchResults = showSearchResults;
	}

	public Boolean isEnabledSearcher() {
		return searcherEnabled;
	}
	
	public void enableSearcher() {
		searcherEnabled = true;
	}
	
	public void disableSearcher() {
		searcherEnabled = false;
	}
	
	public Searcher getSearcher() {
		return searcher;
	}

	public void setSearcher(Searcher searcher) {
		this.searcher = searcher;
	}

	public PagingBean getPagingBean() {
		return pagingBean;
	}

	public void setPagingBean(PagingBean paging) {
		this.pagingBean = paging;
	}
		
	public List<Order> getOrderList() {
		return orderList;
	}

	/**
	 * Adds an order property
	 * @param property
	 * @param ascending, if false decreasing 
	 */
	public void addOrder(String property, boolean ascending){
		orderList.add(new Order(property, ascending));
	}	
	
}
